package dwz.web.management;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import dwz.common.util.web.PageInfo;
import dwz.common.util.web.PageUtil;
import dwz.framework.member.persistence.object.UsrMember;
import dwz.framework.member.services.MemberServiceMgr;
import dwz.web.BaseController;

@Controller
@RequestMapping(value="/management/user")
public class UserController extends BaseController {
	@Autowired
	private MemberServiceMgr memberMgr;
	@RequestMapping("")
	public ModelAndView list(HttpServletRequest request,HttpServletResponse response) {
		
		ModelAndView view = new ModelAndView();
		List<UsrMember> memberList = memberMgr.getMembers(null, 0, 0);
		PageInfo pageInfo = this.getPagingBean(request);
		//System.out.println(request.getParameterMap());
		//model.addAttribute("memberList",memberList);
		//PageUtil util = new PageUtil();
		view.addObject("memberList",memberList);
		view.addObject("pagingBean", PageUtil.getPapination(pageInfo, memberMgr.getTotalMembers(null)));
		view.setViewName("/management/user/list");
		return view;
	}
}
